<?php

namespace app\common\model\mysql;

use think\Model;

class SOrderRecord extends Model
{
    /**
     * @var mixed
     */
    private $id;

    /**
     * 添加订单操作日志
     * @param $memberId
     * @param $records
     * @param $personnelType
     * @param $orderId
     * @return mixed
     */
    public function addOrderRecord($memberId,$records,$personnelType,$orderId){
        $record['admin_id']    = $memberId;
        $record['records']     = $records;
        $record['create_time'] = date("Y-m-d H:i:s",time());
        $record['personnel_type'] = $personnelType;
        $record['order_id']    = $orderId;
        $this->save($record);
        return $this->id;
    }

    /**查询订单操作日志
     * @param $where
     * @param $field
     * @return SOrderRecord[]|array|\think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function getOrderRecordList($where,$field = "*"){
        $order = [
            "order_record_id" =>"asc",
        ];
        $result = $this->where($where)->field($field)->order($order)->select();
        return $result;
    }
}
